package ch03_oothinking.oop;

import lombok.Data;

import java.util.Optional;

/**
 * The class/interface
 *
 * @author guodd
 * @version 1.0 use jdk 1.8
 */
@Data
public class Obj {
    /**
     * 属性描述：年龄
     */
    private Integer age;

    /**
     * 属性描述：姓名
     */
    private String name;


    public Optional<String> getNameById(Long id) {
        Obj user = new Obj();
        user.setName("bb");
        return Optional.ofNullable(user).map(Obj::getName);
    }


    public static void main(String[] args) {
        Obj obj = new Obj();
        Optional<String> nameById = obj.getNameById(1L);
        String aa = nameById.orElse("");
        System.out.println(aa);
    }
}


